
<article class="module width_3_quarter">
 <div>控制权限：1-民生家园<strong>(多个请用#分割)</strong></div>
    <header>
      <h3 class="tabs_involved">用户管理</h3>
      <ul class="tabs">
        <li>用户名：<input type="text"  name="user_name" style="width:50px" /> <input type="button" class="alt_btn" value="GO" onclick="userSearchByUserName()"/></li>
        <li>邮箱：<input type="text"  name="email" style="width:50px"/> <input type="button" class="alt_btn" value="GO" onclick="userSearchByEmail()"/></li>
         <li><a href="admins.php?act=user_export">导出</a></li>
      </ul>
    </header>
   
    <div class="tab_container">
      <div id="tab1" class="tab_content">
        <table class="tablesorter" cellspacing="0">
          <thead>
            <tr>
             <th>ID</th>
             <th>用户名</th>
             <th>昵称</th>
             <th>邮箱</th>
            <th>权限</th>
             <th>电话</th>
             <th>积分</th>
              <th>状态</th>
              
              <th>操作</th>
            </tr>
          </thead>
          <tbody>
          {{foreach from=$user_list key=key item=list}}
            <tr>
              <td>{{$list.user_id}}</td>
              <td>{{$list.user_name}}</td>
              <td>{{$list.info.nick_name}}</td>
              <td>{{$list.email}}</td>
               <td><input type="text" size="3" value="{{$list.level}}" onchange="changeLevel('{{$list.user_id}}',this.value)"/></td>
               <td>{{$list.info.tel}}</td>
              <td><input type="text" value="{{$list.gold}}" onchange="changeGold('{{$list.user_id}}','{{$list.gold}}',this.value)" size="3"/></td>
              <td>{{if $list.status==1}}<span class="green">已审核</span>{{else if $list.status==-1}}<span class="red">禁用</span>{{else}}<span class="red">未审核</span>{{/if}}</td>
           	  
              <td>
              <a  class="alt_btn"  href="admins.php?act=user_info&user_id={{$list.user_id}}">编辑</a>
              <a  class="alt_btn" href="admins.php?act=user_del&user_id={{$list.user_id}}">删除</a>
              </td>
            </tr>
         {{/foreach}}  
          </tbody>
        </table>
      </div>
      <!-- end of #tab1 -->
      <!-- end of #tab2 --> 
      
    </div>
    <!-- end of .tab_container --> 
    
  </article>
  {{include file="../../pages.htm"}}
  
  <script language="javascript">
 function userSearchByUserName(){
	 var user_name = $("input[name=user_name]").val();
	
	 if(user_name)
	 {
		 
	 	location.href = 'admins.php?act=user_list&user_name='+user_name
	 
	 }
	 else
	 {
		alert('请输入有效的用户名');	 
	 }
	 
 }
  function userSearchByEmail(){
	
	 var email = $("input[name=email]").val();
	 if(email)
	 {
		 
	 	location.href = 'admins.php?act=user_list&email='+email
	 
	 }
	 else
	 {
		alert('请输入有效的email');	 
	 }
	 
 }
 function changeGold(user_id,gold,val){
	 if(user_id*1>0)
	 {
		 var data = new Object;
		 //var def = "系统返回"+gold+" 小区币 给 "+user_name+"  操作人:system";
	  	 var yes = prompt("理由");
		 data.comment = yes;
		
		 data.user_id = user_id;
		
		 data.return = val*1-gold*1;
		
		 if(yes)
		 {
			
			var da = "act=send_gold&data="+$.toJSON(data);
			Main.AJAX("admins.php",da,changeGoldRes);
		 }
		 
		 
	 }
 }
 function changeGoldRes(){
	 $("#tab1").load('admins.php?act=goods_cat #tab1',{},function(){
	 	$("#tab1").hide().fadeIn("slow");
	 });
	// location.href = location.href;
}
 function changeLevel(user_id,level){
	 if(user_id*1>0 && level)
	 {
		var data ={user_id:user_id,level:level};
		var da = "act=change_level&data="+$.toJSON(data);
		Main.AJAX("admins.php",da);
		 
		 
	 }
 }

</script>